home *** CD-ROM | disk | FTP | other *** search
/ Super PC 27 / Super PC 27 (ClarisWorks y shareware).iso / clarisde / disk1 / 32sinst.mst < prev    next >
Encoding:
Text File  |  1995-07-10  |  11.4 KB  |  409 lines

  1. '*                  MS Test script for Win32s setup program
  2. '**************************************************************************
  3.  
  4. '' $DEFINE DEBUG  ''Define for script development/debugging
  5.  
  6. '$INCLUDE 'setupapi.inc'
  7. '$INCLUDE 'msdetect.inc'
  8.  
  9. ''Dialog ID's
  10. CONST WELCOME                  = 100
  11. CONST ASKQUIT                  = 200
  12. CONST DESTPATH                 = 300
  13. CONST EXITFAILURE              = 400
  14. CONST EXITQUIT                 = 600
  15. CONST EXITSUCCESS              = 700
  16. CONST OPTIONS                  = 800
  17. CONST BADPATH                  = 6400
  18.  
  19. CONST HELPWELCOME              = 1000
  20. CONST VERPATH                  = 1100
  21. CONST EXITFAILNOTWIN31         = 1200
  22. CONST EXITFAILNOTENH           = 1300
  23. CONST EXITFAILNOTPAGING        = 1325
  24. CONST EXITFAILNOTINTEL         = 1350
  25. CONST FREECELLINST             = 1400
  26. CONST FREECELLINSTNOWIN32S     = 1450
  27. CONST FREECELLPATH             = 1500
  28. CONST HELPFREECELL             = 1600
  29.  
  30.  
  31. ''Bitmap ID
  32. CONST LOGO = 1
  33.  
  34. GLOBAL DESTSYS$      ''Windows\System directory.
  35. GLOBAL DEST32S$      ''Windows\System\Win32s directory
  36. GLOBAL DESTFREE$     ''Freecell directory
  37.  
  38. GLOBAL DESTWIN$      '' Windows Directory - ClarisInstaller
  39. GLOBAL RUNBUF$       '' Run= buffer - ClarisInstaller
  40. GLOBAL WIN32ENABLED%
  41. GLOBAL WINDIR$  
  42.  
  43. DECLARE SUB Install
  44. DECLARE SUB UpdateSystemIni
  45. DECLARE SUB RebootSystem
  46. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  47. DECLARE FUNCTION MakeSystemIni LIB "INIUPD.DLL" (arg1$, arg2$) AS INTEGER
  48. DECLARE FUNCTION RestartWindows LIB "INIUPD.DLL" AS INTEGER
  49. DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  50. DECLARE FUNCTION PagingEnabled LIB "INIUPD.DLL" AS INTEGER
  51. DECLARE FUNCTION ShareEnabled LIB "INIUPD.DLL" AS INTEGER
  52. DECLARE FUNCTION IsWin32sLoaded LIB "INIUPD.DLL" (arg1$) AS INTEGER
  53. DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (arg1$, arg2$) AS INTEGER
  54.  
  55. INIT:
  56.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  57.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  58.     szOldVer$ ="1.00.000     "          ''Reserve space in string for version
  59.     WIN32ENABLED% = 0
  60.  
  61.     ON ERROR GOTO ERRNORMAL
  62.  
  63.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  64.  
  65.     SetBitmap CUIDLL$, LOGO
  66.     
  67.     '' claris
  68.     SetTitle "Programa de instalaci≤n de Microsoft Win32s / ClarisWorks 3.0 Demo"
  69.  
  70.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  71.     IF szInf$ = "" THEN
  72.     szInf$ = GetSymbolValue("STF_CWDDIR") + "32sinst.inf"
  73.     END IF
  74.     ReadInfFile szInf$
  75.  
  76.     DESTSYS$ = GetWindowsSysDir()
  77.     DEST32S$ = DESTSYS + "WIN32S\"
  78.  
  79. CHECK:
  80.     IF GetWindowsMajorVersion < 3 THEN
  81.     ExitCode% = EXITFAILNOTWIN31
  82.     GOTO QUIT
  83.     END IF
  84.     
  85.     IF GetWindowsMajorVersion = 3 AND GetWindowsMinorVersion < 1 THEN
  86.     ExitCode% = EXITFAILNOTWIN31
  87.     GOTO QUIT
  88.     END IF
  89.     
  90.     IF GetWindowsMajorVersion >= 4 THEN
  91.     ExitCode% = EXITSUCCESS
  92.     WIN32ENABLED% = 1
  93.     GOTO COPYFILES
  94.     END IF
  95.     
  96.     IF GetWindowsMode < 2  THEN
  97.     IF OnWindowsNT() THEN
  98.        ExitCode% = EXITFAILNOTINTEL '' Running on Windows NT (on RISC)
  99.     ELSE
  100.        ExitCode% = EXITFAILNOTENH   '' Standard Mode Windows
  101.     END IF
  102.     
  103.     GOTO QUIT
  104.     END IF
  105.     
  106.     IF OnWindowsNT() THEN
  107.     ExitCode% = EXITSUCCESS
  108.     WIN32ENABLED% = 1
  109.     GOTO COPYFILES
  110.     END IF
  111.     
  112.     ExitCode% = EXITSUCCESS
  113.  
  114.  
  115.     '' Get version of Win32s to be installed from version info in file
  116.     szNewVer$ = GetVersionOfFile( GetSymbolValue("STF_SRCDIR") + "WIN32S16.DLL" )
  117.  
  118.     '' Check if Win32s is partially installed
  119.     sz$ = GetIniKeyString (DESTSYS$ + "WIN32S.INI", "Win32s", "Setup")
  120.     '' If WIN32S.INI specifies Setup=0, then force complete Win32s file overwrite
  121.     IF sz$ = "0" THEN
  122.     GOTO WELCOME
  123.     END IF
  124.     '' If WIN32S.INI is missing, try and reinstall Win32s files/recreate WIN32S.INI
  125.     IF sz$ <> "1" THEN
  126.     GOTO WELCOME
  127.     END IF
  128.  
  129.     '' If Win32s is already installed, get running version number
  130.     i% = DoesFileExist( DESTSYS$ + "W32SYS.DLL", femExists )
  131.     IF i% = 1 THEN
  132.     i% = IsWin32sLoaded( szOldVer$ )
  133.     ENDIF
  134.  
  135.     IF i% = 0 THEN
  136.     GOTO WELCOME
  137.     END IF
  138.     
  139.     IF szNewVer$ > szOldVer$ THEN
  140.     GOTO WELCOME
  141.     END IF
  142.     
  143.     WIN32ENABLED% = 1
  144.     
  145.     GOTO COPYFILES
  146.  
  147.  
  148. WELCOME:
  149.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", HELPWELCOME, HELPPROC$)
  150.     IF sz$ = "CONTINUE" THEN
  151.     UIPop 1
  152.     ELSE
  153.     GOSUB ASKQUIT
  154.     GOTO WELCOME
  155.     END IF
  156.  
  157.  
  158. GETWIN32SPATH:
  159.     IF PagingEnabled() = 0 THEN
  160.     i% = DoMsgBox("Utilice el Panel de control 386 Extendido y configure Windows para que utilice la Memoria virtual.", "Win32s necesita memoria virtual", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  161.     ExitCode% = EXITFAILURE '' Enhanced mode but not paging
  162.     GOTO QUIT
  163.     END IF
  164.  
  165.     ''IF ShareEnabled() = 0 THEN
  166.     ''i% = DoMsgBox( "File-sharing must be enabled. Run SHARE.EXE before starting Windows or add SHARE.EXE to your AUTOEXEC.BAT file.", "Win32s Setup: SHARE.EXE is not loaded", MB_TASKMODAL+MB_ICONEXCLAMATION+MB_OK)
  167.     ''END IF
  168.  
  169.     SetSymbolValue "EditTextIn", DESTSYS$
  170.     SetSymbolValue "EditFocus", "END"
  171.  
  172. GETPATHL1:
  173.     sz$ = UIStartDlg(CUIDLL$, VERPATH, "FDispDlgProc", HELPWELCOME, HELPPROC$)
  174.  
  175.     IF sz$ = "CONTINUE" THEN
  176.     IF IsDirWritable(DESTSYS$) = 0 THEN
  177.         GOSUB BADPATH
  178.         GOTO GETPATHL1
  179.     END IF
  180.     UIPop 1
  181.     ELSEIF sz$ = "REACTIVATE" THEN
  182.     GOTO GETPATHL1
  183.     ELSEIF sz$ = "BACK" THEN
  184.     UIPop 1
  185.     GOTO WELCOME
  186.     ELSE
  187.     GOSUB ASKQUIT
  188.     GOTO GETPATHL1
  189.     END IF
  190.  
  191.  
  192. COPYFILES:
  193.     
  194.     IF WIN32ENABLED% <> 1 THEN
  195.     CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite
  196.     END IF
  197.     
  198.     '' Indicate Win32s install failure until all files known to be copied.
  199.     
  200.     ExitCode% = EXITFAILURE
  201.     
  202.     ERR = 0
  203.  
  204.     
  205.     IF WIN32ENABLED% <> 1 THEN
  206.     CreateDir DEST32S$, cmoNone
  207.     END IF
  208.  
  209.     
  210.     Install
  211.     
  212.     '' Terminate if unhandled fatal error
  213.     IF ERR <> 0 THEN
  214.     GOTO QUIT
  215.     END IF
  216.     
  217.     IF WIN32ENABLED% <> 1 THEN
  218.     UpdateSystemIni
  219.     END IF
  220.  
  221.     IF WIN32ENABLED% <> 1 THEN
  222.     CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "1", cmoOverwrite
  223.     CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Version", szNewVer$, cmoOverwrite
  224.     CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Nls", "AnsiCP", "1252", cmoOverwrite
  225.     END IF
  226.  
  227.  
  228.     ERR = 0
  229.     CreateProgmanGroup "CW3DEMO", "", cmoNone
  230.     ShowProgmanGroup   "CW3DEMO", 1, cmoNone
  231.     CreateProgmanItem  "CW3DEMO", "ClarisWorks 3.0 DEMO", "C:\CW3DEMO\CLWORKS.EXE", "", cmoOverwrite
  232.     CreateProgmanItem  "CW3DEMO", "Para empezar", "C:\CW3DEMO\CLWORKS.EXE C:\CW3DEMO\EMPEZAR.CWK", "C:\CW3DEMO\CLWORKS.EXE, 1", cmoOverwrite
  233.  
  234.     WINDIR$ = GetWindowsDir()
  235.     CreateIniKeyValue WINDIR$ + "CW3DEMO.INI", "Claris", "Claris Directory", "C:\CW3DEMO\CLARIS",cmoOverwrite
  236.     
  237.     i% = DoMsgBox("Win 32s/Demo se ha instalado correctamente.", "Instalaci≤n de Microsoft Win32s", MB_OK+MB_TASKMODAL)
  238.     
  239.     '' Indicate Win32s correctly copied and installed.
  240.     ExitCode% = EXITSUCCESS
  241.     
  242.  
  243.  
  244. QUIT:
  245.     '' Install error handler for final message box routines
  246.     ON ERROR GOTO ERRQUIT
  247.     IF ERR = 0 THEN
  248.     dlg% = ExitCode%
  249.     ELSEIF ERR = STFQUIT THEN
  250.     dlg% = EXITQUIT
  251.     ExitCode% = EXITQUIT
  252.     ELSE
  253.     dlg% = EXITFAILURE
  254.     ExitCode% = EXITQUIT
  255.     END IF
  256.  
  257. QUITL1:
  258.     IF WIN32ENABLED% = 1 THEN
  259.     UIPop 1
  260.     END
  261.     END IF
  262.  
  263.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  264.     IF sz$ = "REACTIVATE" THEN
  265.     GOTO QUITL1
  266.     END IF
  267.     UIPop 1
  268.  
  269.     IF ExitCode% = EXITSUCCESS THEN
  270.     RebootSystem
  271.     CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite
  272.     i% = DoMsgBox("Win32s is not properly configured and Win32s Setup must be run again.", "Unable to Restart Windows", MB_ICONEXCLAMATION+MB_OK+MB_TASKMODAL)
  273.     ENDIF
  274.  
  275.     END
  276.  
  277. '' Fatal error handler for error message routine
  278. ERRQUIT:
  279.     i% = DoMsgBox("Setup sources were corrupted!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  280.     END
  281.  
  282. '' Bypass run-time errors. Let final dialog box display fatal error message.
  283. ERRNORMAL:
  284.     '' Check if user cancelled setup
  285.     IF ERR = STFQUIT THEN
  286.     GOTO QUIT
  287.     END IF
  288.     RESUME NEXT
  289.  
  290.  
  291. BADPATH:
  292.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  293.     IF sz$ = "REACTIVATE" THEN
  294.     GOTO BADPATH
  295.     END IF
  296.     UIPop 1
  297.     RETURN
  298.  
  299.   ASKQUIT:
  300.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  301.  
  302.     IF sz$ = "EXIT" THEN
  303.     UIPopAll
  304.     ERROR STFQUIT
  305.     ELSEIF sz$ = "REACTIVATE" THEN
  306.     GOTO ASKQUIT
  307.     ELSE
  308.     UIPop 1
  309.     END IF
  310.     RETURN
  311.  
  312.  
  313.  
  314. '**
  315. '** Purpose:
  316. '**     Builds the copy list and performs all installation operations.
  317. '** Arguments:
  318. '**     none.
  319. '** Returns:
  320. '**     none.
  321. '*************************************************************************
  322. SUB Install STATIC
  323.  
  324.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  325.  
  326.     IF WIN32ENABLED% <> 1 THEN
  327.     
  328.     '' Use file layout sections that specify OLDER file version/time check
  329.     AddSectionFilesToCopyList "WindowsSystem", SrcDir$, DESTSYS$
  330.     AddSectionFilesToCopyList "WindowsSystemWin32s", SrcDir$, DESTSYS$ + "WIN32S\"
  331.  
  332.     '' Add obsolete files to be removed
  333.     AddSectionFilesToCopyList "Win32sSystemObsoleteFiles", SrcDir$, DESTSYS$ + "WIN32S\"
  334.  
  335.     SetRestartDir GetWindowsDir()
  336.     
  337.     END IF
  338.  
  339.     DESTWIN$ = "C:\CW3DEMO"
  340.     CreateDir DESTWIN$, cmoNone
  341.     AddSectionFilesToCopyList "CW3Trial1", SrcDir$, DESTWIN$
  342.  
  343.     DESTWIN$ = "C:\CW3DEMO\CLARIS"
  344.     CreateDir DESTWIN$, cmoNone
  345.     AddSectionFilesToCopyList "CW3Trial2", SrcDir$, DESTWIN$
  346.     
  347.     DESTWIN$ = "C:\CW3DEMO\CLARIS\ASSISTNT"
  348.     CreateDir DESTWIN$, cmoNone
  349.     AddSectionFilesToCopyList "CW3Trial3", SrcDir$, DESTWIN$
  350.     '' Claris
  351.  
  352.     CopyFilesInCopyList
  353.  
  354. END SUB
  355.  
  356.  
  357. SUB UpdateSystemIni STATIC
  358.  
  359.     VxDPath$ = DEST32S$ + "W32S.386"
  360.     SystemIniPath$ = GetWindowsDir()
  361.  
  362.     t% = MakeSystemIni(SystemIniPath$, VxdPath$)
  363.  
  364. END SUB
  365.  
  366. SUB RebootSystem STATIC
  367.  
  368. '   Check if any files were locked during install.  If the RestartList
  369. '   is not empty, ExitExecRestart() will restart Windows, cleanup setup
  370. '   files, and copy over locked files before Windows restarts.
  371.     i% = RestartListEmpty()
  372.     IF i% = 0 THEN
  373. '      ExitExecRestart() only returns if applications refuse to be shutdown.
  374. '      Win32s is installed but will not operate until Windows is restarted
  375. '      and the Win32s VxD is loaded.
  376.        i% = ExitExecRestart()
  377.      ELSE
  378. '      If the RestartList list is empty, it is necessary to restart windows
  379. '      directly.  The MSSETUP program creates _MSRSTRT.EXE and _MSSETUP.BAT
  380. '      in the restart directory.  This program should be exec'd to handle
  381. '      proper MSSETUP cleanup (temp files) and restart Windows.
  382.        i% = ExitWindowsExec( GetWindowsDir() + "_MSRSTRT.EXE", "_MSSETUP.BAT" )
  383.      ENDIF
  384.  
  385. END SUB
  386.  
  387.  
  388. '**
  389. '** Purpose:
  390. '**     Appends a file name to the end of a directory path,
  391. '**     inserting a backslash character as needed.
  392. '** Arguments:
  393. '**     szDir$  - full directory path (with optional ending "\")
  394. '**     szFile$ - filename to append to directory
  395. '** Returns:
  396. '**     Resulting fully qualified path name.
  397. '*************************************************************************
  398. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  399.     IF szDir$ = "" THEN
  400.     MakePath = szFile$
  401.     ELSEIF szFile$ = "" THEN
  402.     MakePath = szDir$
  403.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  404.     MakePath = szDir$ + szFile$
  405.     ELSE
  406.     MakePath = szDir$ + "\" + szFile$
  407.     END IF
  408. END FUNCTION
  409.